/**
 * @filename:SysApplicationServiceImpl 2022年1月27日
 * @project Wonder wallet Framework  V1.0
 * Copyright(c) 2018 LuZhongren Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.admin.service.impl;

import com.wonder.admin.domain.SysApplication;
import com.wonder.admin.mapper.SysApplicationDao;
import com.wonder.admin.service.SysApplicationService;
import com.wonder.admin.request.SysApplicationRequest;
import com.wonder.common.utils.StringUtils;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**   
 * @Description:TODO(应用管理服务实现)
 *
 * @version: V1.0
 * @author: LuZhongren
 * 
 */
@Service
public class SysApplicationServiceImpl  extends ServiceImpl<SysApplicationDao, SysApplication> implements SysApplicationService  {

   /**
     * 修改应用管理信息
     * 
     * @param SysApplication信息
     * @return 结果
     */
    @Override
    public int updateEx(SysApplication sysApplication){
       if(sysApplication!=null)
		     return this.baseMapper.updateById(sysApplication);
       return 0;
    }
    
    
    /**
	 * Description:应用管理分页返回
	 * @request:检索条件
	 * @page：分页参数
	 * @return:分页记录
	 */
	@Override 
	public IPage<SysApplication> selectList(SysApplicationRequest request, Page<SysApplication> page){
	    LambdaQueryWrapper<SysApplication> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    if (null != request.getApp_id()) {
	       lambdaQueryWrapper.eq(SysApplication::getApp_id, request.getApp_id());
	      }               
        if (StringUtils.isNotBlank(request.getApplication_name())) {
			lambdaQueryWrapper.eq(SysApplication::getApplication_name, request.getApplication_name());
		} 
        
		lambdaQueryWrapper.orderByDesc(SysApplication::getApp_id);	
		Page<SysApplication> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);

		return selectPage;
    }
    
	
}